#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <string.h>
#include <queue>
using namespace std;
bool cmp(int x, int y)
{
    return x > y;
}
int main()
{
    int N;
    while (~scanf("%d", &N) && N)
    {
        int color[15];
        for (int i = 0; i < N; i++)
            scanf("%d", &color[i]);
        int gray; // 灰色数量
        scanf("%d", &gray);
        sort(color, color + N, cmp);
        int kits = color[0] % 50 == 0 ? color[0] / 50 : color[0] / 50 + 1;
        for (int i = 0; i < N; i++)
            color[i] = kits * 50 - color[i];
        while (gray) // 一点点的勾兑灰色
        {
            sort(color, color + N, cmp);
            if (color[2] <= 0)
            {
                kits++;
                for (int i = 0; i < N; i++)
                    color[i] += 50;
            }
            for (int i = 0; i < 3; i++)
                color[i]--;
            gray--;
        }
        printf("%d\n", kits);
    }
    return 0;
}
